package com.sgu6.redis.dto;


import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.List;

public class GoodsSimpleDto implements Serializable, Comparable<GoodsSimpleDto> {
    /**
     * id : 89195196f46b4f4e96f8f4f83d55ab34
     * name : 糙米
     * title : 糙米
     * categoryId : 70f23f3121d541dabcc4b78838a99268
     * shortContent : 富含纤维素，有减肥、降胆固醇、通便等功效
     * content : 富含纤维素，有减肥、降胆固醇、通便等功效
     * model : 长粒
     * price : 4.99
     * photo : [{"id":"88e04d3a59404787b7d248a0ba0314c0","imgUrl":"/Upload/goods/20161026/caomi.jpg","sort":1,"show":true}]
     * cmd : 2
     * sort : 1
     * enable : true
     */
    private static final long serialVersionUID = 5579606425129820930L;

    private String id;
    private String name;
    private String title;
    private String categoryId;
    private String shortContent;
    private String content;
    private String model;
    private BigDecimal price;
    private String cmd;
    private int sort;
    private boolean enable;
    private List<PhotoBean> photo;
    private String barnId;


    @Override
    public int compareTo(GoodsSimpleDto o) {
        return this.sort - o.sort;
    }
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        if (obj instanceof GoodsSimpleDto) {
            GoodsSimpleDto dto = (GoodsSimpleDto) obj;
            return dto.name.equals(this.name) && dto.title.equals(this.title) && dto.shortContent.equals(this.shortContent) && dto.price.equals(this.price);
        }
        return false;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public String getShortContent() {
        return shortContent;
    }

    public void setShortContent(String shortContent) {
        this.shortContent = shortContent;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getCmd() {
        return cmd;
    }

    public void setCmd(String cmd) {
        this.cmd = cmd;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public List<PhotoBean> getPhoto() {
        return photo;
    }

    public void setPhoto(List<PhotoBean> photo) {
        this.photo = photo;
    }

    public static class PhotoBean implements Serializable {
        /**
         * id : 88e04d3a59404787b7d248a0ba0314c0
         * imgUrl : /Upload/goods/20161026/caomi.jpg
         * sort : 1
         * show : true
         */

        private String id;
        private String imgUrl;
        private int sort;
        private boolean show;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getImgUrl() {
            return imgUrl;
        }

        public void setImgUrl(String imgUrl) {
            this.imgUrl = imgUrl;
        }

        public int getSort() {
            return sort;
        }

        public void setSort(int sort) {
            this.sort = sort;
        }

        public boolean isShow() {
            return show;
        }

        public void setShow(boolean show) {
            this.show = show;
        }
    }

    public String getBarnId() {
        return barnId;
    }

    public void setBarnId(String barnId) {
        this.barnId = barnId;
    }
}
